package com.sky.mapper;

import com.sky.entity.OrderDetail;
import com.sky.vo.SalesTop10VO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderDetailMapper {
    /**
     * 插入订单明细表
     * @param list
     */
    void insert(List<OrderDetail> list);

    /**
     * 批量插入订单明细表
     * @param orderDetails
     */
    void insertBatch(List<OrderDetail> orderDetails);

    /**
     * 根据订单id获取订单细节
     * @param id
     * @return
     */
    @Select("select * from order_detail where order_id=#{id}")
    List<OrderDetail> selectByOrderId(Long id);

    /**
     * 查询期间内的销量前十及对应销量
     * @param begin
     * @param end
     * @return
     */
    List<SalesTop10VO> getSalesTop10(LocalDate begin, LocalDate end);
}
